home *** CD-ROM | disk | FTP | other *** search
/ Deutsche Edition 1 / Deutsche Edition 1.iso / amok / 031-040 / amok38 / coco / demo / fileio.def < prev    next >
Encoding:
Modula Definition  |  1993-11-04  |  1.9 KB  |  66 lines

  1. (* FileIO     Simple IO with more than one file         Moe 18.01.84
  2.    ======        =================================
  3. This module provides procedures which are similar to those of InOut,
  4. except that they can be used with more than one file even with the
  5. console).
  6. ------------------------------------------------------------------------*)
  7. DEFINITION MODULE FileIO;
  8.  
  9. FROM FileSystem IMPORT File;
  10. FROM SYSTEM     IMPORT WORD;
  11.  
  12. (*EXPORT QUALIFIED
  13.   DEL, EF, EOL, ESC,
  14.   con, Done, termCH,
  15.   Read, Write, WriteCard, WriteLn, WriteString,
  16.   WriteText, WriteWord;                      (*25.11.,D,Dob*)   *)
  17.  
  18. CONST
  19.   DEL = 177C;
  20.   EF  =   4C;
  21.   EOL =  36C;
  22.   ESC =  33C;
  23.  
  24. VAR
  25.   con:    File;            (*console file*)
  26.   Done:   BOOLEAN;         (*TRUE if an operation sucessful*)
  27.   termCH: CHAR;            (*first character after input text*)
  28.  
  29. PROCEDURE Read(VAR f:File; VAR ch:CHAR);
  30. (* Reads a character ch from the  file f (no echo on the console)*)
  31.  
  32. PROCEDURE Write(VAR f:File; ch:CHAR);
  33. (* Writes a character ch to the file f*)
  34.  
  35. PROCEDURE ReadCard(VAR f:File; VAR val:CARDINAL);
  36.  
  37. PROCEDURE WriteCard(VAR f:File; nr:CARDINAL; w:CARDINAL);
  38. (* Writes a cardinal nr with width w to the file f. If the actual
  39.    width of nr is bigger than w, w is expanded*)
  40.  
  41. PROCEDURE ReadInt(VAR f:File; VAR val:INTEGER);   
  42.  
  43. PROCEDURE WriteInt(VAR f:File; i:INTEGER; w:CARDINAL);
  44.  
  45. PROCEDURE ReadLn(VAR f:File);
  46. (* Skips to the next line on the file f*)
  47.  
  48. PROCEDURE WriteLn(VAR f:File);
  49. (* Skips to the next line on the file f*)
  50.  
  51. PROCEDURE ReadString(VAR f:File; VAR s:ARRAY OF CHAR);
  52.  
  53. PROCEDURE WriteString(VAR f:File; s:ARRAY OF CHAR);
  54. (* Write a string s to the file f. An occurrence of the character "$"
  55.    in s causes a line feed*)
  56.  
  57. PROCEDURE WriteText(VAR f:File; t:ARRAY OF CHAR; l:CARDINAL);
  58. (* Writes a text t with length l to the file f*)
  59.  
  60. PROCEDURE ReadWord(VAR f:File; VAR w:CARDINAL);  
  61.  
  62. PROCEDURE WriteWord(VAR f:File; w:CARDINAL);
  63. (* Writes a word w without conversion to the file f*)
  64.  
  65. END FileIO.
  66.